//
//  ShowDetailCommentTableViewCell.m
//  Taste
//
//  Created by 徐昊 on 16/9/13.
//  Copyright © 2016年 徐昊. All rights reserved.
//

#import "ShowDetailCommentTableViewCell.h"
#import "ShowDetailCommentsRes.h"
#import "UIImageView+WebCache.h"
#import "NSString+Vali.h"

@interface ShowDetailCommentTableViewCell ()
@property (weak, nonatomic) IBOutlet UIImageView *headImg;
@property (weak, nonatomic) IBOutlet UILabel *nickName;
@property (weak, nonatomic) IBOutlet UILabel *addTime;
@property (weak, nonatomic) IBOutlet UILabel *content;


@end

@implementation ShowDetailCommentTableViewCell

- (void)setRes:(ShowDetailCommentsRes *)res {
    _res = res;
    [_headImg sd_setImageWithURL:[NSURL URLWithString:[NSString imageWebWithStr:_res.headimg]] placeholderImage:[UIImage imageNamed:@"IMG_Universal_Placeholder_Avatar"] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
    }];
    _nickName.text = _res.nickname;
    _addTime.text = _res.addtime;
    if (_res.replayname) {
        _content.text = [NSString stringWithFormat:@"回复 %@: %@", _res.replayname, _res.content];
    } else {
        _content.text = _res.content;
    }
}
- (void)awakeFromNib {
    // Initialization code
    [super awakeFromNib];
    _headImg.contentMode = UIViewContentModeScaleAspectFill;
    _headImg.clipsToBounds = YES;
    _headImg.layer.masksToBounds = YES;
    _headImg.layer.cornerRadius = _headImg.bounds.size.width / 2;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
